﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace TB_WS.ASMX
{
    /// <summary>
    /// Seller_User 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class Seller_User : System.Web.Services.WebService
    {

        [WebMethod(Description ="根据用户名和商家ID 更新最后一次登录时间")]
        public void UPDATE_USER_LAST_LOGIN_TIME(int Seller_ID,string User_Name)
        {
            Class.Seller_User.update_last_login_time(Seller_ID, User_Name);
        }

        [WebMethod(Description ="修改用户密码")]
        public int UPDATE_USER_PWD(int Seller_ID,string User_Name,string New_PWD)
        {
            return Class.Seller_User.update_user_pwd(Seller_ID, User_Name, New_PWD);
        }

       

        [WebMethod(Description = "校验用户名和密码登录是否正确-新")]
        public int CONFORM_LOGIN_NEW(int Seller_ID, string User_Name, string User_PWD)
        {
            int Count = Class.Seller_User.Conform_Login(Seller_ID, User_Name, User_PWD);
            if (Count == 1)
            {
                Class.Seller_User.update_last_login_time(Seller_ID, User_Name);//更新时间
                return 0;
            }
            else
            {
                return 1;
            }
        }

        [WebMethod(Description = "校验用户名和密码登录是否正确-新")]
        public int CONFORM_LOGIN_VER(int Seller_ID, string User_Name, string User_PWD,string Version)
        {
            int Count = Class.Seller_User.Conform_Login(Seller_ID, User_Name, User_PWD);
            if (Count == 1)
            {
                if (Version == "1.0")
                {
                    Class.Seller_User.update_last_login_time(Seller_ID, User_Name);//更新时间
                    return 0;
                }
                else
                {
                    return 2;
                }
            }
            else
            {
                return 1;
            }
        }

        [WebMethod(Description ="获取用户列表")]
        public DataSet GET_USER_LIST(int Seller_ID,string Type)
        {
            return Class.Seller_User.get_User_List(Seller_ID,Type);
        }

        [WebMethod(Description = "新增一个用户")]
        public int INSERT_USER(int Seller_ID, string User_Name, string User_PWD)
        {
            return Class.Seller_User.insert_Seller_User(Seller_ID,
                User_Name, User_PWD);
        }

        [WebMethod(Description ="获取用户数量")]
        public int GET_USER_COUNT(int Seller_ID,string User_Name)
        {
            return Class.Seller_User.Get_User_Count(User_Name, Seller_ID);
        }

        [WebMethod(Description = "更新用户状态")]
        public int UPDATE_USER_TYPE(int Seller_ID, string User_Name, string Type)
        {
            return Class.Seller_User.update_user_type(Seller_ID, User_Name, Type);
        }
        
    }
}
